using UnityEngine;
using QFramework;
using QFramework.Example;

namespace ProjectSurvivor
{
	public partial class Bomb : GameplayObject
	{
		void OnTriggerEnter2D(Collider2D other)
		{
			if (other.GetComponent<CollectableArea>())
			{
				foreach(var enemyObj in GameObject.FindGameObjectsWithTag("Enemy"))
				{
					var enemy=enemyObj.GetComponent<Enemy>();
					if(enemy&&enemy.gameObject.activeSelf)
					{
						enemy.Hurt(enemy.HP);
					}

				}
				AudioKit.PlaySound("Bomb");
				CameraController.Shake();
				UIGamePanel.FlashScreen.Trigger();
				//删除
				this.DestroyGameObjGracefully();
			}

		}
		protected override Collider2D Collider2D =>SelfCollider2D;
	}
}
